/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package lcfgly.database.utils;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;

/**
 * LDataExceptionAop
 * 对数据库操作异常进行aop拦截处理基类
 * @author lcfgly
 * @Date 2015-1-30 9:54:34
 * @version 1.0
 */
public class LDataExceptionAop {

    public Object AroundThrowingBack(ProceedingJoinPoint  jp){
        MethodSignature m=(MethodSignature)jp.getSignature();
        Class c=m.getReturnType();
        if(c.isAssignableFrom(boolean.class)||c.isAssignableFrom(Boolean.class))
            return false;
        else if(c.isAssignableFrom(short.class) || c.isAssignableFrom(Short.class)||c.isAssignableFrom(int.class) || 
                c.isAssignableFrom(Integer.class) ||c.isAssignableFrom(byte.class) || c.isAssignableFrom(Byte.class) || 
                c.isAssignableFrom(char.class) || c.isAssignableFrom(long.class) || c.isAssignableFrom(Long.class))
            return 0;
        else if(c.isAssignableFrom(float.class) || c.isAssignableFrom(Float.class) || c.isAssignableFrom(double.class) || c.isAssignableFrom(Double.class))
            return 0.0;
        else
            return null;
    }
    
}
